<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <div id="app">
    <button @click="add">增加arr</button>
    <ul ref="oul">
      <li v-for="item in arr" :key="item">
        {{item}}
      </li>
    </ul>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      el:"#app",
      data:{
        arr:[1,2,3,4]
      },
      methods:{
        add(){
          this.arr.push(this.arr.length+1);
          this.$nextTick(()=>{
            this.$refs['oul'].lastChild.style.background="blue"
          })
        }
      }
    })
  </script>
</body>
</html>
